#include<iostream>
#include<unistd.h>
#include<signal.h>


void ChangeSign(int signum)
{
     std::cout << "我捕获到了2号信号" << std::endl;
}


int main()
{
    signal(2,ChangeSign);
    while(true)
    {
       std::cout << "无限死循环执行中" <<std::endl;
       sleep(1);
    }
    return 0;
}